{% extends "BackendBundle::backend.html.twig" %}

{% set vars = {'ruta' : app.request.attributes.get('_route')} %}

{% block title %}{{ "Oferta"|trans }}{% endblock %}

{% block header %}

    {% include "BackendBundle::topmenu.html.twig" with vars %}

{% endblock %}

{% block left %}

    {% include "ContentBundle:Hotel:menuleft.html.twig" with vars %}

{% endblock %}

{% block content %}
		<link href="{{ asset("bundles/images/css/default.css") }}" rel="stylesheet" type="text/css" />
		<link href="{{ asset("bundles/images/css/uploadify.css") }}" rel="stylesheet" type="text/css" />
		<link href="{{ asset("bundles/images/js/Jcrop/css/jquery.Jcrop.css") }}" rel="stylesheet" type="text/css" />
		
		<script type="text/javascript" src="{{ asset("bundles/images/js/jquery-1.4.2.min.js") }}"></script>
		<script type="text/javascript" src="{{ asset("bundles/images/js/swfobject.js") }}"></script>
		<script type="text/javascript" src="{{ asset("bundles/images/js/jquery.uploadify.v2.1.0.min.js") }}"></script>
		<script type="text/javascript" src="{{ asset("bundles/images/js/jquery-impromptu.3.1.min.js") }}"></script>
		<script type="text/javascript" src="{{ asset("bundles/images/js/Jcrop/js/jquery.Jcrop.min.js") }}"></script>
		<script type="text/javascript" src="{{ asset("bundles/images/js/jquery-uberuploadcropper.js") }}"></script>
		
		<script type="text/javascript">
			$(function() {
				
				$('#UploadPhoto').uberuploadcropper({
					//---------------------------------------------------
					// uploadify options..
					//---------------------------------------------------
					'uploader'  : '{{ asset("bundles/images/js/uploadify.swf") }}',
					'script'    : '{{ asset("bundles/images/uploadify.php") }}',
					'cancelImg' : '{{ asset("bundles/images/images/cancel.png") }}',
					'multi'     : false,
					'auto'      : true,
					'folder'    : '{{ asset("bundles/images/uploads") }}',
					'fileDesc'  : 'JPG',
					'fileExt'   : '*.jpg;*.jpeg',
					//---------------------------------------------------
					//now the cropper options..
					//---------------------------------------------------
					//'aspectRatio': 1, 
					'allowSelect': false,			//can reselect
					'allowResize' : false,			//can resize selection
					'setSelect': [ 0, 0, 200, 200 ],	//these are the dimensions of the crop box x1,y1,x2,y2
					//'minSize': [ 100, 100 ],		//if you want to be able to resize, use these
					//'maxSize': [ 100, 100 ],
					/*
					onError: function (a, b, c, d) {
						if (d.status == 404)
							alert('Could not find upload script. Use a path relative to: '+'<?= getcwd() ?>');
						else if (d.type === "HTTP")
							alert('error '+d.type+": "+d.status);
						else if (d.type ==="File Size")
							alert(c.name+' '+d.type+' Limit: '+Math.round(d.sizeLimit/1024)+'KB');
						else
							alert('error '+d.type+": "+d.text);
					},*/
					//---------------------------------------------------
					//now the uber options..
					//---------------------------------------------------
					'cropScript': 'bundles/images/crop.php',
					'onComplete': function(imgs,data){ 
						$('#PhotoPrev').attr('src','bundles/images/uploads/'+imgs[0].name +'?d='+ (new Date()).getTime()); 
					}
				});
				
			});
		</script>
		
<div class="span9">
    
        <h2>{{ "Añadir ofertas"|trans }}</h2>

<form name="paco" id="paco" class="form-horizontal" method="" action="">

<fieldset><legend><small>{{ "Datos oferta"|trans }}</small></legend>

<div class="control-group">
<label class="control-label" for="hotel">{{ "Hotel"|trans }}</label>
  <div class="controls">
  <select name="hotel" id="hotel">
    {% for hotel in hoteles %}
      <option value="">{{ hotel.hotelname }}</option>
    {% endfor %}
  </select>
</div>
</div>

<div class="control-group">
<label class="control-label" for="title">{{ "Título"|trans }}</label>
  <div class="controls">
<input name="title" id="title" type="text">
</div>
</div>

<div class="control-group">
<label class="control-label" for="entradilla">{{ "Entradilla"|trans }}</label>
  <div class="controls">
<textarea name="entradilla"></textarea>
</div>
</div>

<div class="control-group">
<label class="control-label" for="incluye">{{ "Incluye"|trans }}</label>
  <div class="controls">
<textarea name="incluye"></textarea>
</div>
</div>

</fieldset>

<fieldset><legend><small>{{ "Precio"|trans }}</small></legend>


<div class="control-group">
<label class="control-label" for="textoPrecio">{{ "Texto"|trans }}</label> 
  <div class="controls">
  <select name="textoPrecio" id="textoPrecio">
    <option value="1">A partir de ... por persona.</option>
    <option value="2">Ahorre con un ... de descuento.</option>
    <option value="3">A partir de ... por habitación</option>
  </select>
</div>
</div>

<div class="control-group">
<label class="control-label" for="cantidad">{{ "Cantidad"|trans }}</label>
  <div class="controls">
<input name="cantidad" id="cantidad" type="text">
</div>
</div>

</fieldset>

<fieldset><legend><small>{{ "Fotografía"|trans }}</small></legend>

    <input type="file" name="UploadPhoto" id="UploadPhoto" />
    <img class="span2" src="{{ asset("bundles/images/images/photo_not_available.png") }}" id="PhotoPrev" alt="Photo Preview" />
		
</fieldset>

<div class="form-actions">
  <input name="" id="" class="btn btn-primary" type="submit" value="{{ "Añadir"|trans }}">
  <a href="" class="btn">{{ "Cancelar"|trans }}</a>
</div>  

</form>

</div>
{% endblock %}